﻿using Basic.FormGatewaryModular.Interface;
using Basic.FormRemoteModel.PageControl.Model;
using WeDonekRpc.ApiGateway.Attr;
using WeDonekRpc.Helper.Validate;
using WeDonekRpc.HttpApiGateway;

namespace Basic.FormGatewaryModular.Api
{
    [ApiRouteName("/form/page/control/{name}")]
    internal class PageControlApi : ApiController
    {
        private readonly IPageControlService _Service;

        public PageControlApi ( IPageControlService service )
        {
            this._Service = service;
        }

        public PageControlDto Get ( [NumValidate("form.page.control.id.error", 1)] long id )
        {
            return this._Service.Get(id);
        }

        public PageControlItem[] GetItems ( bool isEdit = true )
        {
            return this._Service.GetItems(isEdit);
        }
    }
}
